# TODO: Add comment
# 
# Author: rogb
###############################################################################


### Class Currency ############################################################

setClass("Currency",
		representation=list(
				Currency="character"
		)
)

Currency <- function(Currency){
	new("Currency",Currency=Currency)	
}

currency <- function(object){
	object@Currency
}

"currency<-" <- function(object,value){
	object@Currency <- value
	object
}

###############################################################################

setClass("DayCountConvention",
		representation=list(
				DayCountConvention="character"
		)
)

DayCountConvention <- function(DayCountConvention){
	new("DayCountConvention",DayCountConvention=DayCountConvention)
}

dayCountConvention <- function(object){
	object@DayCountConvention
}

"dayCountConvention<-" <- function(object,value){
	object@DayCountConvention <- value
	object
}

###############################################################################


setClass("EffectiveDate",
		representation=list(
				EffectiveDate="Date"		
		)
)

effectiveDate <- function(object){
	object@EffectiveDate
}

effectiveDate.character <- function(object){
	as.character(object@EffectiveDate)
}

"effectiveDate<-" <- function(object,value){
	object@EffectiveDate <- value
	object
}

###############################################################################


setClass("Exchange",
		representation=list(
				Exchange="character"
		),
		prototype=list(
				Exchange="DEFAULTEXCHANGE"
		)
)

Exchange <- function(Exchange){
	new("Exchange",Exchange=Exchange)
}

exchange <- function(object){
	object@Exchange
}

"exchange<-" <- function(object,value){
	object@Exchange <- value
	object
}

###############################################################################


setClass("MaturityDate",
		representation=list(
				MaturityDate="Date"		
		)
)

maturityDate <- function(object){
	object@MaturityDate
}

maturityDate.character <- function(object){
	as.character(object@MaturityDate)
}

"maturityDate<-" <- function(object,value){
	object@MaturityDate <- value
	object
}

###############################################################################

setClass("Name",
		representation=list(
				Name="character"
		)
)

Name <- function(Name){
	new("Name",Name=Name)	
}

name <- function(object){
	object@Name
}

"name<-" <- function(object,value){
	object@Name <- value
	object
}

###############################################################################

setClass("Nominal",
		representation=list(
				Nominal="numeric"
		)
)

nominal <- function(object){
	object@Nominal
}

"nominal<-" <- function(object,value){
	object@Nominal <- value
	object
}

###############################################################################

setClass("Quantity",
		representation=list(
				Quantity="numeric"
		)
)

quantity <- function(object){
	object@Quantity
}

"quantity<-" <- function(object,value){
	object@Quantity <- value
	object
}

###############################################################################

setClass("SituationDate",
		representation=list(
				SituationDate="Date"		
		)
)

situationDate <- function(object){
	object@SituationDate
}

situationDate.character <- function(object){
	as.character(object@SituationDate)
}

"situationDate<-" <- function(object,value){
	object@SituationDate <- value
	object
}

###############################################################################

setClass("Strike",
		representation=list(
				Strike="numeric"
		)
)

Strike <- function(Strike){
	new("Strike",Strike=Strike)	
}

strike <- function(object){
	object@Strike
}

"strike<-" <- function(object,value){
	object@Strike <- value
	object
}

###############################################################################

setClass("Price",
		representation=list(
				Price="numeric"
		),prototype=list(
				Price=numeric(0)		
		)
)

# constructor function
Price <- function(Price){
	new("Price",Price=Price)
}

# methods on object
setMethod("show","Price",function(object){
			cat("Price: ",cashNumberToText(object@Price),"\n")
		})

price <- function(object){
			object@Price
		}

"price<-" <- function(object,value){
			object@Price <- value
			object
		}

###############################################################################

setClass("OptionType",
		representation=list(
				OptionType="character"
		)
)

OptionType <- function(OptionType){
	new("OptionType",OptionType=OptionType)
}

# methods on object
optionType <- function(object){
	object@OptionType
}

"optionType<-" <- function(object,value){
	object@OptionType <- value
	object
}

###############################################################################

setClass("Underlying",
		representation=list(
				Underlying="character"
		)
)

Underlying <- function(Underlying){
	new("Underlying",Underlying=Underlying)
}

# methods on object
underlying <- function(object){
	object@Underlying
}

"underlying<-" <- function(object,value){
	object@Underlying <- value
	object
}
###############################################################################

setClass("UnderlyingValue",
		representation=list(
				UnderlyingValue="numeric"
		)
)

UnderlyingValue <- function(UnderlyingValue){
	new("UnderlyingValue",UnderlyingValue=UnderlyingValue)
}

# methods on object
underlyingValue <- function(object){
	object@UnderlyingValue
}

"underlyingValue<-" <- function(object,value){
	object@UnderlyingValue <- value
	object
}

###############################################################################


setClass("ImpliedVolatility",
		representation=list(
				ImpliedVolatility="numeric"
		)
)

ImpliedVolatility <- function(ImpliedVolatility){
	new("ImpliedVolatility",ImpliedVolatility=ImpliedVolatility)
}

# methods on object
impliedVolatility <- function(object){
	object@ImpliedVolatility
}

"impliedVolatility<-" <- function(object,value){
	object@ImpliedVolatility <- value
	object
}

###############################################################################

setClass("RiskFreeRate",
		representation=list(
				RiskFreeRate="numeric"
		),
		prototype=list(
				RiskFreeRate=0		
		)
)

RiskFreeRate <- function(RiskFreeRate){
	new("RiskFreeRate",RiskFreeRate=RiskFreeRate)
}

# methods on object
riskFreeRate <- function(object){
	object@RiskFreeRate
}

"riskFreeRate<-" <- function(object,value){
	object@RiskFreeRate <- value
	object
}

###############################################################################

setClass("CostOfCarryRate",
		representation=list(
				CostOfCarryRate="numeric"
		),
		prototype=list(
				CostOfCarryRate=0		
		)
)

CostOfCarryRate <- function(CostOfCarryRate){
	new("CostOfCarryRate",CostOfCarryRate=CostOfCarryRate)
}

# methods on object
costOfCarryRate <- function(object){
	object@CostOfCarryRate
}

"costOfCarryRate<-" <- function(object,value){
	object@CostOfCarryRate <- value
	object
}
###############################################################################

setClass("Rate",
		representation=list(
				Rate="numeric"
		),
		prototype=list(
				Rate=0		
		)
)

Rate <- function(Rate){
	new("Rate",Rate=Rate)
}

# methods on object
rate <- function(object){
	object@Rate
}

"rate<-" <- function(object,value){
	object@rate <- value
	object
}

###############################################################################

setClass("Term",
		representation=list(
				Term="numeric"
		),
		prototype=list(
				Term=0		
		)
)

Term <- function(Term){
	new("Term",Term=Term)
}

# methods on object
term <- function(object){
	object@Term
}

"term<-" <- function(object,value){
	object@term <- value
	object
}

###############################################################################

setClass("FixPaymentFrequency",
		representation=list(
				FixPaymentFrequency="numeric"
		),
		prototype=list(
				FixPaymentFrequency=0		
		)
)

FixPaymentFrequency <- function(FixPaymentFrequency){
	new("FixPaymentFrequency",FixPaymentFrequency=FixPaymentFrequency)
}

# methods on object
fixPaymentFrequency <- function(object){
	object@FixPaymentFrequency
}

"fixPaymentFrequency<-" <- function(object,value){
	object@FixPaymentFrequency <- value
	object
}

###############################################################################

setClass("FloatPaymentFrequency",
		representation=list(
				FloatPaymentFrequency="numeric"
		),
		prototype=list(
				FloatPaymentFrequency=0		
		)
)

FloatPaymentFrequency <- function(FloatPaymentFrequency){
	new("FloatPaymentFrequency",FloatPaymentFrequency=FloatPaymentFrequency)
}

# methods on object
floatPaymentFrequency <- function(object){
	object@FloatPaymentFrequency
}

"floatPaymentFrequency<-" <- function(object,value){
	object@FloatPaymentFrequency <- value
	object
}

###############################################################################

